/**
 * Created with JetBrains WebStorm.
 * User: Joseph
 * Date: 29/04/12
 * Time: 1:33 AM
 * To change this template use File | Settings | File Templates.
 */
function act_save() {
    var save = {};
    for (var key in state_) {
        if ((key.substr(0, 6) == '_piece') || (key.substr(0, 6) == '_board')) {
            save[key] = state_[key];
        }
    }

    localStorage.setItem('game', JSON.stringify(save));
}

function act_load() {

    var temp = JSON.parse(localStorage.getItem('game'));

    var deleteKeys = gapi.hangout.data.getKeys();
    for (var i = 0, iLen = deleteKeys.length; i < iLen; ++i) {
        gapi.hangout.data.clearValue(deleteKeys[i]);
    }

    for (var key in temp) {
        gapi.hangout.data.setValue(key, temp[key]);
    }

    var submit = {};
    for (var i = 0, iLen = participants_.length; i < iLen; ++i) {
        var p = participants_[i];
        var temp_string = gapi.hangout.data.getValue('fullrender' + p.id);

        if (temp_string != undefined) {
            var x = (1 + parseInt(temp_string));
            submit['fullrender' + p.id] = x.toString();
        }
    }

    saveValue(submit);

}
